import GameConfig from "./config";

export default class LoadingUI extends Laya.Sprite {
    private textField: Laya.Text

    constructor() {
        super()
        this.size(GameConfig.width, GameConfig.height);
        this.createView();
    }

    createView() {
        this.textField = new Laya.Text();
        this.textField.y = GameConfig.height - 100;
        this.textField.fontSize = 30;
        this.textField.width = GameConfig.width;
        this.textField.height = GameConfig.height;
        this.addChild(this.textField);
        this.textField.align = "center"
        this.textField.color = '#ffffff';
    }

    public onProgress(current: number, total: number): void {
        this.textField.text = `Loading...${current}/${total}`;
    }
}